import ENV from '@/config/env.js';
import request from '@/utils/request';
const ApiUrl = ENV.API_URL;

export default {
  /**
   * 下单并支付
   **/
  pay(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/order-and-pay', method: "POST", data, success, error });
    });
  },
  /**
   * 重新发起支付（支付失败的订单）
   **/
  repay(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/re-pay', method: "POST", data, success, error });
    });
  },
  /**
   * 取消订单
   **/
  cancelPay(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/cancel', method: "POST", data, success, error });
    });
  },
  /**
   * 查询订单状态
   **/
  query(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/query', method: "GET", data, success, error });
    });
  },
  /**
   * 分页订单
   **/
  page(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/page-order', method: "GET", data, success, error });
    });
  },
  /**
   * 列表订单明细
   **/
  listIten(data) {
    return new Promise((success, error) => {
      request({ url: ApiUrl + '/pos4/order/user/list-order-item', method: "GET", data, success, error });
    });
  }
};
